<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
Array.prototype.unique = function () {
var hash = {}, result = [], type = '', item;
 for (var i = 0; i < this.length; i++) {
 item = this[i];
 //通过Object.prototype.toString方法，判断某个对象值属于哪种内置类型
 type = Object.prototype.toString.call(item);
 console.log(item + type);
 
     if ( !hash[item + type] ) {
     hash[item + type] = true;
     result.push(item);
     }
}
 console.log(result)
 return result;
};
var arr = [0, 1, '1', true, 5, 5,1, true, false, undefined, undefined, null, null];
arr.unique();



    </script>
</body>
</html>